<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title>招生审核管理列表</title>
    <link rel="stylesheet" type="text/css" href="${s.base}/lib/layui/css/layui.css"/>
    <link rel="stylesheet" type="text/css" href="${s.base}/css/base/index.css"/>
    <link rel="stylesheet" type="text/css" href="${s.base}/css/base/theme/theme.css"/>
</head>
<body>
<div class="wrap-container clearfix">
    <div class="column-content-detail">
        <form class="layui-form" method="post" action="/enrollment/enrollmentstuinfo/export">
            <div class="main-cont-tit">${enrollmentRelease.name}</div>
            <div class="main-cont-tit-lable">
                <ul>
                    <li>报名时间：<#if enrollmentRelease.startTime??>${enrollmentRelease.startTime?string('yyyy-MM-dd HH:mm:ss')}</#if>至<#if enrollmentRelease.endTime??>${enrollmentRelease.endTime?string('yyyy-MM-dd HH:mm:ss')}</#if></li>
                    <li>拟招生<span class="red">${enrollmentRelease.stuNum}</span>人，已通过<span  class="red">${num}</span>人</li>
                </ul>
            </div>
            <input type="hidden" name="applyId" value="${applyId}"/>
            <div class="search-cont clearfix" id="tool">
                <div class="operation-btn-cont">
                    <div class="operright cyt-retract-close hideMenu"> 收起筛选<i class="iconfont">&#xe658;</i></div>
                    <div class="operright cyt-retract-open showMenu" style="display: none;"> 展开筛选<i class="iconfont">&#xe936;</i>
                    </div>
                    <!--button开始-->
                    <button class="layui-btn layui-btn-normal layui-btn-mid" type="button" id="addBtn"><i
                            class="iconfont marr5">&#xe65e;</i>添加
                    </button>
                    <button class="layui-btn layui-btn-normal layui-btn-mid" type="button" id="editBtn"><i
                            class="iconfont marr5">&#xe606;</i>编辑
                    </button>
                    <button class="layui-btn layui-btn-normal layui-btn-mid" type="button" id="deleteBtn"><i
                            class="iconfont marr5">&#xe6a3;</i>删除
                    </button>
                    <button class="layui-btn layui-btn-normal layui-btn-mid importBtn" type="button"
                            data-download="/upload/EnrollmentStuinfo.xlsx"
                            data-url="/enrollment/enrollmentstuinfo/importData?releaseId=${releaseId}&applyId=${applyId}"><i
                            class="iconfont marr5">&#xe612;</i>导入
                    </button>
                    <button class="layui-btn layui-btn-normal layui-btn-mid" type="submit"><i class="iconfont marr5">&#xe614;</i>导出
                    </button>
                    <button class="layui-btn layui-btn-normal layui-btn-mid" type="button" id="checkAll"><i
                            class="iconfont marr5">&#xe69e;</i>一键审核
                    </button>
                    <button class="layui-btn layui-btn-normal layui-btn-mid" type="button" id="Tj"><i
                            class="iconfont marr5">&#xe67d;</i>统计分析
                    </button>
                    <!--button结束-->
                    <div class="triangle-bottom"></div>
                    <div class="triangle-top"></div>
                </div>
                <div class="search-details">
                    <div class="layui-form-item marb5">
                        <!--search开始-->
                        <div class="layui-inline">
                            <label class="layui-form-label">准考证号：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="testNum" placeholder="请输入准考证号" autocomplete="off"
                                       class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">姓名：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="name" placeholder="请输入姓名" autocomplete="off"
                                       class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">联系方式：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="phone" placeholder="请输入联系方式" autocomplete="off"
                                       class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">审核状态：</label>
                            <div class="layui-input-inline">
                                <select name="reviewState" id="reviewState">

                                </select>
                            </div>
                        </div>
                        <!--search结束-->
                        <div class="layui-inline marl8">
                            <button class="layui-btn layui-btn-normal" type="button" lay-submit=""
                                    lay-filter="seacherBtn">
                                搜索
                            </button>
                            <button class="layui-btn layui-btn-normal" type="reset">重置</button>
                        </div>
                    </div>
                </div>
            </div>
        </form>
        <div class="layui-form" id="table-list">
            <table id="entityList" lay-filter="entityList" class="cy-list-table"></table>
        </div>
    </div>
</div>
<!--操作-->
<script type="text/html" id="entityBar">
    <a class="layui-btn layui-btn-radius layui-btn-primary layui-btn-sm layui-smbtn-green" lay-event="check">审核</a>
    <a class="layui-btn layui-btn-radius layui-btn-primary layui-btn-sm layui-smbtn-green" lay-event="look">查看</a>
</script>
<script src="${s.base}/lib/layui/layui.js" type="text/javascript" charset="utf-8"></script>
<script src="${s.base}/js/common.js" type="text/javascript" charset="utf-8"></script>
<script>
    var tableIns = null;
    var applyId='${applyId}';
    var releaseId='${releaseId}';
    layui.use(['jquery', 'table', 'page', 'dialog','laydate','baseutil'], function () {
        var $ = layui.jquery,
            page = layui.page,
            table = layui.table,
            laydate=layui.laydate,
            baseutil=layui.baseutil,
            dialog = layui.dialog;
        //获取分页数据
        page.initDict('base_status,review_state,sexType', function (dictData) {
            page.showDict($("#reviewState"), page.aceeptDictContentList(dictData, 'review_state'), "全部");
            var url = "/enrollment/enrollmentstuinfo/page?releaseId="+releaseId;
            var cols = [
                {type: 'checkbox', fixed: 'left'},
                {field: 'testNum', title: '准考证号', align: 'center'},
                {field: 'name', title: '学生姓名', align: 'center'},
                {
                    field: 'sex', title: '性别', align: 'center', templet: function (d) {
                    return page.aceeptDictContentName(dictData, 'sexType', d.sex);
                }
                },
                {field: 'phone', title: '联系方式', align: 'center'},
                {field: 'school', title: '毕业学校', align: 'center'},
                {
                    field: 'createTime', title: '申请时间', align: 'center', templet: function (d) {
                    return new Date(d.createTime).Format("yyyy-MM-dd hh:mm:ss");
                }
                },
                {
                    field: 'reviewState', title: '审核状态', align: 'center', templet: function (d) {
                        if(d.reviewState==="1"){
                            return '<span style="color: grey">' + page.aceeptDictContentName(dictData, 'review_state', d.reviewState) + '</span>';
                        }else if(d.reviewState==="2"){
                            return '<span style="color: green">' + page.aceeptDictContentName(dictData, 'review_state', d.reviewState) + '</span>';
                        }else if(d.reviewState==="3"){
                            return '<span style="color: red">' + page.aceeptDictContentName(dictData, 'review_state', d.reviewState) + '</span>';
                        }
                }
                },
                {title: '操作', width: 220, templet: '#entityBar', align: "center"}
            ];
            tableIns = page.initDate(cols, url);
        });

        //监听行工具事件
        table.on('tool(entityList)', function (obj) {
            var layEvent = obj.event,
                data = obj.data;
            var menuId=parent.getTabId();
            if (layEvent === 'check') {
                if(data.reviewState==="1"){
                    page.edit("enrollmentStuinfoCheck",'/enrollment/enrollmentstuinfo/getCheck?applyId='+applyId+'&id=' + data.id+'&parentMenuId='+menuId+'&releaseId='+releaseId, '审核');
                }else{
                    dialog.msg("该条信息已审核，请查看！");
                }}
            if (layEvent === 'look') {
                if(data.reviewState!="1"){
                    page.edit("enrollmentStuinfoLook",'/enrollment/enrollmentstuinfo/getDetail?applyId='+applyId+'&id=' + data.id, '查看');
                }else{
                    dialog.msg("该条信息未审核，请先审核！");
                }
            }
        });
        //监听添加按钮事件
        $('#addBtn').bind('click', function () {
            if('${releaseState}'==='3'){
                dialog.msg("该招生已结束,不能新建信息！");
                return false;
            }else{
                page.edit("enrollmentStuinfoEdit",'/enrollment/enrollmentstuinfo/getEdit?applyId=' + applyId+'&releaseId='+releaseId+'&parentMenuId='+parent.getTabId(), '添加');
            }
        });

        $("#Tj").bind('click',function(){
            page.edit("enrollmentStuinfoTj",'/enrollment/enrollmentstuinfo/getTj?applyId=' + applyId+'&releaseId='+releaseId+'&parentMenuId='+parent.getTabId(), '统计分析');
        });

        //监听删除按钮事件
        $('#deleteBtn').bind('click', function () {
            var data = table.checkStatus('entityList').data;
            if (data.length === 0) {
                dialog.msg("请先选择对象");
                return false;
            } else {
                var ids = [];
                for (var i = 0; i < data.length; i++) {
                    ids.push(data[i].id)
                }
                page.delete('/enrollment/enrollmentstuinfo/remove', {
                    "id": ids.join(","),
                    "_method": "DELETE"
                }, "您确定要删除吗？", function () {
                    table.reload("entityList", {
                        where: {}
                    });
                });
            }
        });
        //监听编辑时间
        $('#editBtn').bind('click', function () {
            var data = table.checkStatus('entityList').data;
            if (data.length === 0) {
                dialog.msg("请先选择对象");
                return false;
            } else if (data.length === 1) {
                page.edit("enrollmentStuinfoEdit",'/enrollment/enrollmentstuinfo/getEdit?applyId=' + applyId + '&id=' + data[0].id+'&releaseId='+releaseId+'&parentMenuId='+parent.getTabId(), '编辑');
            } else if (data.length > 1) {
                dialog.msg("请选择单个");
                return false;
            }
        });
        //监听编辑时间
        $('#checkAll').bind('click', function () {
            //优化点--先判断是否存在待审核的
            page.edit("enrollmentCheckAll",'/enrollment/enrollmentstuinfo/getCheckAll?applyId='+applyId+'&releaseId=' + releaseId+'&parentMenuId='+parent.getTabId(), '一键审核');
        });
    });
</script>
</body>
</html>